import { createRouter, createWebHistory } from 'vue-router';

import Layout from '../views/layout/index.vue';
import Home from '../views/index/index.vue';
import Clazz from '../views/clazz/index.vue';
import Stu from '../views/stu/index.vue';
import Dept from '../views/dept/index.vue';
import Emp from '../views/emp/index.vue';
import EmpReport from '../views/report/emp/index.vue';
import StuReport from '../views/report/stu/index.vue';
import Log from '../views/log/index.vue';
import Login from '../views/login/index.vue';

const routes = [
  //嵌套路由
  { path: '/', 
    component: Layout,
    children:[
      { path: '/', redirect: '/index' },
      { path: '/index', component: Home },
      { path: '/clazz', component: Clazz },
      { path: '/stu', component: Stu },
      { path: '/dept', component: Dept },
      { path: '/emp', component: Emp },
      { path: '/empReport', component: EmpReport },
      { path: '/stuReport', component: StuReport },
      { path: '/log', component: Log }
    ]
  },
  { path: '/login', component: Login }
];

// 创建路由实例
const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;